<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title></title>
</head>
<body>
		<script type="text/javascript">
			
			let p =new Promise(function(resolve,reject){
				setTimeout(function(){
					let flag = true
					if(flag){
						resolve('我被执行成功')
					}else{
						reject('我执行失败')
					}
				},2000)
			})
			
			p.then(function(res){
				console.log(res)
			})
			p.catch(function(res){
				console.log(res)
			})
		</script>
</body>
</html>